local skel = fk.CreateSkill {
  name = "lb_zero__mengyao_leizhu",
}

Fk:loadTranslationTable {
  ["lb_zero__mengyao_leizhu"] = "雷蛛",
  [":lb_zero__mengyao_leizhu"] = "当你受到伤害后，你可以对伤害来源造成1点雷属性伤害，然后你弃置一张装备牌或失去此技能。",

  ["#lb_zero__mengyao_leizhu"] = "雷蛛：你可以对%dest造成1点雷电伤害，然后你弃置一张装备牌或失去〖雷蛛〗",
  ["#lb_zero__mengyao_leizhu-dis"] = "雷蛛：请弃置一张装备牌，或取消后失去〖雷蛛〗",

  ["$lb_zero__mengyao_leizhu1"] = "",
  ["$lb_zero__mengyao_leizhu2"] = "",
}

skel:addEffect(fk.Damaged, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and data.from and data.from:isAlive()
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player,
      { skill_name = skel.name, prompt = "#lb_zero__mengyao_leizhu::" .. data.from.id, })
  end,
  on_use = function(self, event, target, player, data)
    data.extra_data = data.extra_data or {}
    data.extra_data.lb_zero__huiyin = true
    local room = player.room
    room:damage {
      from = player,
      to = data.from,
      damage = 1,
      damageType = fk.ThunderDamage,
      skillName = skel.name,
    }
    if player:isAlive() then
      local cards = room:askToDiscard(player, {
        min_num = 1,
        max_num = 1,
        skill_name = skel.name,
        pattern = ".|.|.|.|.|equip",
        include_equip = true,
        cancelable = player:hasSkill(skel.name, true),
        prompt = "#lb_zero__mengyao_leizhu-dis",
      })
      if #cards == 0 and player:hasSkill(skel.name, true) then
        room:handleAddLoseSkills(player, "-" .. skel.name)
      end
    end
  end,
})

return skel
